<template>
  <v-app id="inspire">
    <v-content>
      <v-container >
        <h1 style="text-align: center">Review Status of {{meetingName}}</h1>
        <displayList
          :_items="distributions"
          :_item-per-page="4"
        >
        </displayList>
      </v-container>
      <side-bar></side-bar>
    </v-content>
  </v-app>
</template>

<script>
  import SideBar from './SideBar'
import DisplayList from '../DisplayList'
export default {
  name: 'ReviewStatusInThisConference',
  components: {
    SideBar,
    DisplayList
  },
  data () {
    const generationDistributions = _ => {
      const conferences = []
      this.$axios.post('/allDistributionInThisConference', this.$route.params.id)
        .then(resp => {
          if (resp != null) {
            var response = resp.data
            response.forEach((distribution, index) => {
              conferences.push({
                pcMember: distribution.username,
                meetingFullName: distribution.meetingFullName,
                fileTitle: distribution.fileTitle,
                statusMessage: distribution.status === 0 ? 'Not Reviewed' : (distribution.status === 1? 'Reviewed but not Confirmed': (distribution.status === 2? 'Confirmed':'Second Confirmed'))})
            })
            return conferences
          } else return null
        })
        .catch(error => {
          console.log(error)
        })
      return conferences
    }
    return {
      meetingName: this.$route.params.id,
      distributions: generationDistributions()
    }
  }
}
</script>
